package com.kzj.common.log.impl;

import com.kzj.common.config.ConfigProperties;
import com.kzj.common.log.Log;
import sun.util.resources.LocaleData;

import java.sql.SQLOutput;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public class LogImpl implements Log {
    static private DateTimeFormatter formatter;
    public LogImpl(){
        formatter= DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
    }
    @Override
    public void debug(String info) {
        System.out.println(String.format("Log-> time: %s level: DEBUG, info: %s", LocalDateTime.now().format(formatter),info));
    }

    @Override
    public void info(String info) {
        System.out.println(String.format("Log-> time: %s level: INFO, info: %s",LocalDateTime.now().format(formatter),info));
    }

    @Override
    public void warn(String warnInfo) {
        System.out.println(String.format("Log-> time: %s level: WARNING, info: %s",LocalDateTime.now().format(formatter),warnInfo));
    }

    @Override
    public void warn(String warnInfo, Exception e) {
        System.out.println(String.format("Log-> time: %s level: WARNING, info: %s \n,exception info: %s",LocalDateTime.now().format(formatter),warnInfo,e.toString()));
    }

    @Override
    public void error(String errorInfo) {
        System.out.println(String.format("Log-> time: %s level: ERROR, info: %s",LocalDateTime.now().format(formatter),errorInfo));
    }

    @Override
    public void error(String errorInfo,Exception e) {
        System.out.println(String.format("Log-> time: %s level: ERROR, info: %s \n,exception info: %s",LocalDateTime.now().format(formatter),errorInfo,e.toString()));
    }
}
